package com.linlei.bluetoothchat.common;

import android.app.ActionBar;
import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;

/**
 * Created by LinLei on 2015/3/16.
 */
public class BaseActivity extends ActionBarActivity {

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        return super.onCreateOptionsMenu(menu);
    }

    public void initToolbar(Toolbar toolbar) {
        setSupportActionBar(toolbar);
        android.support.v7.app.ActionBar mActionBar = getSupportActionBar();
        if(null == mActionBar)
            return;
        mActionBar.setHomeButtonEnabled(true);
        mActionBar.setDisplayHomeAsUpEnabled(true);
    }

    public void logD(String msg) {
        Log.d(this.getClass().getName(), msg);
    }

    public void logE(String msg) {
        Log.e(this.getClass().getName(), msg);
    }

    public void showToastInShort(String msg) {
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    }

}
